package ink.wbc.easyrule.rule;

import ink.wbc.drools.entity.User;
import org.jeasy.rules.annotation.*;

/**
 * @author wbc
 * @date 2021/9/15
 * @desc
 */
@Rule(name = "lotteryRule", description = "抽奖规则")
public class LotteryRule {

    @Condition
    public boolean isAllowLottery(@Fact("user") User user) {
        return user.getMoney() >= 100;
    }

    @Action
    public void allowLottery(@Fact("user") User user) {
        user.setAllowLotteryFlag(1);
    }

    @Priority
    public int getPriority() {
        return 2;
    }

}
